<template>
  <div>
    <el-menu
      :default-active="this.$route.path"
      class="el-menu-vertical-demo"
      background-color="#2d3a4b"
      text-color="#fff"
      :router="true"
    >
      <el-menu-item index="/Home">
        <i class="el-icon-menu" style="color: #fff"></i>
        <span slot="title">首页</span>
      </el-menu-item>
      <el-submenu index="2" >
        <template slot="title">
          <i class="el-icon-search" style="color: #fff"></i>
          <span>查询功能选项</span>
        </template>
            <el-submenu index="2-1" >
                    <template slot="title">
                          <i class="el-icon-document-remove" style="color: #fff"></i>
                          <span>产能系列</span>
                    </template>
                    <div @click="handieonclick">
                       <el-menu-item index="/function_statis">产能统计</el-menu-item>
                      <el-menu-item index="/activation">稼动率 TT统计</el-menu-item>
                      <el-menu-item index="/function_glo">产能对比分析</el-menu-item>
                    </div>
            </el-submenu>
         
            <el-submenu index="2-2">
                <template slot="title">
                    <i class="el-icon-warning-outline" style="color: #fff"></i>
                    <span>缺陷系列</span>
                </template>
                 <div @click="handieonclick">
                    <el-menu-item index="/function_table">缺陷数据统计</el-menu-item>
                    <el-menu-item index="/function_drawback">缺陷密集性分析</el-menu-item>
                    <el-menu-item index="/function_capacity">缺陷对比分析</el-menu-item>
                    <el-menu-item index="/Defectsback">缺陷回溯统计</el-menu-item>
                 </div>
            </el-submenu>
        
           <el-submenu index="2-3">
               <template slot="title">
                    <i class="el-icon-setting" style="color: #fff"></i>
                    <span>设备系列</span>
                </template>
                <el-menu-item index="/function_facility">设备密集性分析</el-menu-item>
                <el-menu-item index="/Equcheck">设备过漏检验统计</el-menu-item>
                <el-menu-item index="/Equipcavity">设备腔体回溯统计</el-menu-item>
                <el-menu-item index="/Unittrend">设备过漏检趋势</el-menu-item>
           </el-submenu>

          <el-submenu index="2-4">
                <template slot="title">
                    <i class="el-icon-user" style="color: #fff"></i>
                    <span>人员系列</span>
                </template>
                <el-menu-item index="/function_staff">复判人员效能统计</el-menu-item>
                <el-menu-item index="/function_query">复判人员密集性统计</el-menu-item>
                <el-menu-item index="/Staffleak">人员漏检统计</el-menu-item>
          </el-submenu>

          <el-submenu index="2-5">
                 <template slot="title">
                    <i class="el-icon-notebook-1" style="color: #fff"></i>
                    <span>产品系列</span>
                </template>
                 <el-menu-item index="/function_serch">产品履历查询</el-menu-item>
                 <el-menu-item index="/function_produce">单一产品缺陷分析</el-menu-item>
          </el-submenu>
        <el-menu-item index="/Warningrecord">预警记录</el-menu-item>
      </el-submenu>
  
  
      <el-submenu index="3">
        <template slot="title">
          <i class="el-icon-star-on" style="color: #fff"></i>
          <span>实时看板选项</span>
        </template>
        <!-- <el-menu-item @click="ren_item">个人信息</el-menu-item>  -->
        <!-- <el-menu-item @click="function_warning">连续预警</el-menu-item>
        <el-menu-item  @click="function_imgwarning">实时连续密集性预警</el-menu-item> -->
        <el-menu-item @click="onclick">设备效能看板</el-menu-item>
        <el-menu-item @click="onclickuin">缺陷趋势看板</el-menu-item>
        <el-menu-item @click="Staffciency">人员效率看板</el-menu-item>
        <el-menu-item @click="Defectsduty">当班缺陷趋势看板</el-menu-item>
        <el-menu-item @click="Earlywarning">预警看板</el-menu-item>
      </el-submenu>

       <el-submenu index="4" v-show="iSshow">
         <template slot="title">
            <i class="el-icon-menu" style="color: #fff"></i>
            <span>设置管理</span>   
           </template>
            <el-menu-item index="/Allocationform">机种设置</el-menu-item>
            <el-menu-item index="/Staffing" >人员设置</el-menu-item>
            <el-menu-item index="/Userprofile" v-show="iSconfigitems">用户设置</el-menu-item>
            <el-menu-item index="/Defeation">缺陷设置</el-menu-item>
            <el-menu-item index="/Facilitydeploy">设备设置</el-menu-item>
            <el-menu-item index="/Warningpeople">预警人员设置</el-menu-item>
            <el-menu-item index="/WarningID">预警ID设置</el-menu-item>
            <el-menu-item index="/Warningconfig">预警设置</el-menu-item>
            <el-menu-item index="/Alertsubscription">预警订阅设置</el-menu-item>
       </el-submenu>
    </el-menu>
  </div>
</template>

<script>
export default {
  data() {
    return {
       iSshow:true,
       iSconfigitems:true
    };
  },
  mounted() {
    this.ishsowfun()
  },
  methods: {
   
   handieonclick(){
    //  console.log(this.$route.path)    
    //  console.log(this.routerNameMap)
    //  this.$store.commit('setKeepAliveLists',routerComponentNameList.join()) 
   },


     ishsowfun(){
       var  Isshow = sessionStorage.getItem('userinfo');
       var  isuser = JSON.parse(Isshow);
      //  console.log(isuser)
        if(isuser.Auth == "superuser"){
          this.iSshow = true;
          this.iSconfigitems = false;
        }else if(isuser.Auth == "user"){
          this.iSshow = false;
          this.iSconfigitems = false;
        }else if(isuser.Auth == "admin"){
           this.iSshow = true;
           this.iSconfigitems = true;
        }
     },

    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    onclick() {
      let router = this.$router.resolve({
        path: "/real-time",
      });

      window.open(router.href);
    },
    ren_item() {
      let router = this.$router.resolve({
        path: "/ren_item",
      });

      window.open(router.href);
    },

    function_warning(){
      let router = this.$router.resolve({
        path:'/function_warning'
      })
       window.open(router.href);
    },
    function_imgwarning(){
      let router = this.$router.resolve({
        path:"/function_imgwarning"
      })
      window.open(router.href)
    },
    onclickuin(){
       let router = this.$router.resolve({
        path: "/real-time2",
      });

      window.open(router.href);
    },
    Staffciency(){
      let router = this.$router.resolve({
        path: "/Staffciency",
      });

      window.open(router.href);
    },
     Defectsduty(){
      let router = this.$router.resolve({
        path: "/Defectsduty",
      });

      window.open(router.href);
    },
    Earlywarning(){
      let router = this.$router.resolve({
        path: "/Earlywarning",
      });

      window.open(router.href);
    }
  },
};
</script>

<style scoped>
.hader_left {
  width: 230px;
  /* height:400px; */
  /* border: 1px solid yellow; */
  box-shadow: 0px 0px 0px 1px gainsboro;
  padding: 10px;
}
.el-menu {
  border-right: none;
}
.el-menu-vertical-demo
{
  position:absolute;
  top:0px
}
.el-submenu .el-menu-item
{
  height:45px;
}
</style>